<?php
class User_Role_RoleDefine extends Model_Database
{
	const _DB_ACL	  = 'acl';

	public function __construct()
	{
	}
//acl 分割数据库
	public static function get_role_name($id)
	{
		$data	= DB::select('role_name')
					->from('user_role_define')
					->where('id','=', $id)
					->execute(self::_DB_ACL)
					->get('role_name', 0);

		return $data;
	}

	public static function get_all_names()
	{
		$data	= DB::select()
					->from('user_role_define')
					->execute(self::_DB_ACL);

		return $data->as_array();
	}

	public static function get_role_id($role_name)
	{
		$data	= DB::select('id')
					->from('user_role_define')
					->where('role_name', '=', $role_name)
					->execute(self::_DB_ACL)
					->get('id', 0);

		return $data;
	}

	public static function get_roleinfo_by_name($role_name)
	{
		$data	= DB::select()
					->from('user_role_define')
					->where('role_name', '=', $role_name)
					->execute(self::_DB_ACL);

		return $data->as_array();

	}

	public static function get_roleinfo_by_id($role_id)
	{
		$data	= DB::select()
					->from('user_role_define')
					->where('id', '=', $role_id)
					->execute(self::_DB_ACL);

		return $data->as_array();

	}
}
?>
